home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / demos / sinescroll_3 / sinescroller.s < prev    next >
Text File  |  1980-01-03  |  4KB  |  225 lines

  1.  
  2.         section sinescroll,code_c
  3.  
  4.         incdir    'src:Exsyslib/'
  5.         include    'include/hardware/custom.i'    ;define customchips
  6.         include    'include/hardware/exsys_takeover.s' ;1st codeline!
  7.  
  8. *-------------- Install a new copperlist..
  9.  
  10.         lea    copperlist(pc),a0
  11.         bsr.s    newcopper
  12.  
  13.         lea    bpl,a0
  14.         move.l    #plane,d0
  15.         move.w    d0,6(a0)
  16.         swap    d0
  17.         move.w    d0,2(a0)
  18.  
  19. main        cmp.b    #100,$dff006
  20.         bne.s    main
  21.  
  22.         bsr    putchar_left
  23.         bsr    blit_scroll
  24.  
  25.         btst    #6,$bfe001    ; check the left mouse button
  26.         bne.s    main
  27.         rts
  28.  
  29. newcopper:    lea     $dff000,a6        ;a6=custom hardware
  30.         move.w    #$7fff,$96(a6)        ;no dma
  31.         move.l    a0,$80(a6)        ;install new copperlist ptr
  32.         move.w    d0,$88(a6)        ;strobe copper
  33.         move.w    #$83c0,$96(a6)        ;enable copper dma
  34.         rts
  35.  
  36.  
  37. delay:        dc.w    8
  38. timer:        dc.w    0
  39.  
  40. putchar_left:    tst.w    timer
  41.         beq    goon
  42.         subq.w    #1,timer
  43.         rts
  44.  
  45. goon:        bsr    blitwait
  46.  
  47. *-------------- blit scroll bitmap to the left
  48.  
  49.         move.l    #plane,$0054(a6)
  50.         move.l    #plane+2,$0050(a6)
  51.         move.l    #$e9f00000,$0040(a6)
  52.         move.l    #$ffffffff,$0044(a6)
  53.         clr.l    $0064(a6)
  54.         move.w    #$0555,$0058(a6)    
  55.         bsr    blitwait
  56.  
  57.         move.w    delay(pc),d0
  58.         subq.w    #1,d0
  59.         beq.s    textout
  60.         move.w    d0,delay    
  61.         rts    
  62.  
  63. textout:    move.w    #8,delay
  64.  
  65.         move.l    textpointer(pc),a0
  66.         moveq    #0,d0
  67.         move.b    (a0)+,d0
  68.         cmp.b    #1,(a0)
  69.         bne.s    lsd_suck
  70.  
  71.         move.w    #200,timer
  72.         move.w    #$20,d0
  73.         addq.l    #1,a0
  74.  
  75. lsd_suck:    tst.b    (a0)
  76.         bne.s    no_restart
  77.  
  78.         lea    text(pc),a0
  79.  
  80. no_restart:    move.l    a0,textpointer
  81.  
  82. lbc34:        cmp.b    #$49,d0
  83.         bne.s    lbc42
  84.         move.w    #5,delay
  85.  
  86. lbc42:        sub.b    #$20,d0
  87.         divu    #$14,d0
  88.         move.w    d0,d1
  89.         clr.w    d0
  90.         swap    d0
  91.         mulu    #$348,d1
  92.         lsl.w    #1,d0
  93.  
  94.         lea    font,a0 ;font
  95.         add.l    d0,a0
  96.         add.l    d1,a0
  97.         lea    plane+42,a1   ;pos
  98.         move.l    (a0),(a1)
  99.         move.l    40*01(a0),44*01(a1)
  100.         move.l    40*02(a0),44*02(a1)
  101.         move.l    40*03(a0),44*03(a1)
  102.         move.l    40*04(a0),44*04(a1)
  103.         move.l    40*05(a0),44*05(a1)
  104.         move.l    40*06(a0),44*06(a1)
  105.         move.l    40*07(a0),44*07(a1)
  106.         move.l    40*08(a0),44*08(a1)
  107.         move.l    40*09(a0),44*09(a1)
  108.         move.l    40*10(a0),44*10(a1)
  109.         move.l    40*11(a0),44*11(a1)
  110.         move.l    40*12(a0),44*12(a1)
  111.         move.l    40*13(a0),44*13(a1)
  112.         move.l    40*14(a0),44*14(a1)
  113.         move.l    40*15(a0),44*15(a1)
  114.         move.l    40*16(a0),44*16(a1)
  115.         move.l    40*17(a0),44*17(a1)
  116.         move.l    40*18(a0),44*18(a1)
  117.         move.l    40*19(a0),44*19(a1)
  118.         rts
  119.  
  120.  
  121.  
  122.  
  123.  
  124. blit_scroll:
  125.         lea    plane+$1000,a1
  126.         not.b    flag            * swap buffer
  127.         beq.s    other
  128.         lea    $2000(a1),a1
  129. other        move.l    a1,d6            * show current buffer
  130.         lea    bpl,a0            *
  131.         move.w    d6,6(a0)
  132.         swap    d6
  133.         move.w    d6,2(a0)
  134.         swap    d6
  135.         
  136. *-------------- blit erase playfield..
  137.  
  138.         bsr    blitwait
  139.         move.l    d6,$0054(a6)
  140.         subq.l    #2,d6
  141.         move.w    #$0100,$0040(a6)
  142.         move.w    #2,$0066(a6)
  143.         move.w    #$2b94+256,$0058(a6)
  144.         bsr    blitwait
  145.  
  146. *-------------- blit sine scroll..
  147.     
  148.         move.w    #$0dfc,$0040(a6)
  149.         move.w    #$0028,$0066(a6)
  150.         move.l    #$0028002a,$0062(a6)
  151.         move.w    #$8400,$0096(a6)        * blit nasty on..
  152.  
  153.         move.l    #plane,d2
  154.         move.l    sinpointer(pc),a2
  155.         move.l    #sintab+960,d7  
  156.         move.w    #$0501,d1
  157.  
  158.         moveq    #(40/2)-1,d3
  159. sine_lines:    move.w    #$8000,d0
  160.         moveq    #16-1,d5
  161. sine_words:    moveq    #0,d4
  162.         move.b    (a2)+,d4
  163.         move.l    d7,a0
  164.         add.w    d4,a0
  165.         add.w    d4,a0
  166.         move.w    (a0),d4
  167.         add.w    d4,d6
  168.         move.l    d6,$4c(a6)
  169.         move.l    d2,$50(a6)
  170.         move.l    d6,$54(a6)
  171.         sub.l    d4,d6
  172.         move.w    d0,$46(a6)
  173.         move.w    d1,$58(a6)
  174.         bsr.s    blitwait
  175.         ror.w    #1,d0
  176.         dbra    d5,sine_words
  177.  
  178.         addq.l    #2,d2
  179.         addq.l    #2,d6
  180.         dbra    d3,sine_lines
  181.  
  182.         move.w    #$0400,$0096(a6)        * blit nasy off
  183.  
  184.         cmp.l    #sintab,sinpointer  ;sintab
  185.         ble.s    next_pos
  186.         subq.l    #1,sinpointer
  187.         rts    
  188.  
  189. next_pos:    add.l    #319,sinpointer
  190.         rts    
  191.     
  192. blitwait:    btst    #14,2(a6)
  193.         bne.s    blitwait
  194.         rts
  195.  
  196. textpointer:    dc.l    text
  197. sinpointer:    dc.l    sintab+$13f
  198. flag:        dc.w    0
  199.  
  200. text:        dc.b    "    SINE# SCROLLER!   ",01," @ MR SINE OF MOST USED EFFECTS INC !!!",0
  201.         even
  202.  
  203. copperlist:    dc.w    $008e,$2c81,$0090,$2cc1
  204.         dc.w    $0092,$0038,$0094,$00d0
  205.         dc.w    $0100,$0200,$0102,$0045
  206.         dc.w    $0108,$0002,$010a,$0002
  207.         dc.w    $0180,$0005,$0182,$000f
  208.         dc.w    $01fc,$0000,$0106,$0000
  209.  
  210.         dc.w    $2001,$fffe,$0100,$1200
  211. bpl        dc.w    $e0
  212.         dc.w    0,$e2
  213.         dc.w    0,$e4
  214.         dc.w    0,$e6
  215.         dc.w    0
  216.  
  217.         dc.w    $e001,$fffe,$0108,-82,$010a,-82
  218.         dc.w    $0182,$00ff
  219.  
  220.         dc.l    -2
  221.  
  222. sintab:        incbin    'src:sinescroller/sin.bin'
  223. font        incbin    'src:sinescroller/fonta'
  224. plane        ds.b    $10000
  225.